<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<JS href="__PUBLIC__js/extjs/ext-all.js" />
<CSS href="__PUBLIC__js/extjs/resources/css/ext-all.css" />
{__NOTOKEN__}
<script>
Ext.onReady(function(){
	//数据文件
	Ext.create('Ext.data.Store',{
		storeId:'datalist',
		fields:['typename','orders'],
		data:{'items':[
			{'typename':'p1','orders':'o1'},
			{'typename':'p2','orders':'o2'}
			]},
		proxy:{
			type:'memory',
			reader:{
				type:'json',
				root:'items'
			}
		}
	});
	win = Ext.create('widget.window', {
        title: '资讯列表管理',
        closable: true,
        closeAction: 'hide',
        width: 600,
        minWidth: 350,
        height: 350,
        layout: {
            type: 'border',
            padding: 5
        },
        items: [{
            region: 'north',
            title: '添加资讯类型',
            height: 100,
            split: true,
            xtype:'form',
            collapsible: true,
            floatable: true,
            url:'__URL__/savetype/',
            layout:'table',
            bodyPadding: 5,
            items:[{
                xtype: 'textfield',
               	fieldLabel:'资讯类型',
               	margins:'10',
               	labelWidth:60,
               	name : 'typename',
               	allowBlank : false
            },{
            	xtype:'textfield',
            	fieldLabel:'展示顺序',
            	name:'orders',
            }],
            buttons:[{
            	text:'重置',
            	handler:function()
            	{
            		this.up('form').getForm().reset();
            	}
            },{
            	text:'提交',
            	formBind: true,
            	disabled:true,
            	handler:function(){
            		var form = this.up('form').getForm();
            		if(form.isValid()){
						form.submit({failure:function(form,action){
							Ext.Msg.alert('出现错误',action.result.msg);
							
						},
						success:function(form,action)
						{
							Ext.Msg.alert('添加成功',action.result.msg,function(btn){
								window.location.reload();
							});
						}
						
						});
            		}
            	}
            	
		}],},
		{
			xtype:'window',
			title:'test',
			region:'south',
				}
		]
    });
	win.show();

})
</script>





</head>
<body>

</body>
</html>
